﻿using Fetches.Fetch.Dto;

namespace Fetches.Process.Pipelines
{
    public abstract class AbstractPipeline
    {
        private AbstractPipeline _nextPipeline;

        public void Initial(string site)
        {
            OnInitial(site);
            _nextPipeline?.Initial(site);
        }

        protected virtual void OnInitial(string site)
        {
        }

        protected abstract void OnProcess(string site, ResultItems result);

        public void Process(string site, ResultItems result)
        {
            OnProcess(site, result);
            _nextPipeline?.Process(site, result);
        }

        public AbstractPipeline SetNextPipeline(AbstractPipeline nextPipeline)
        {
            _nextPipeline = nextPipeline;
            return this;
        }
    }
}